<!--
Copyright (c) 2015 Intel Corporation

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

     http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<div id="statistics-{{$id}}" ng-mouseenter="statsFocus()" ng-mouseleave="statsBlur()">
<div class="row-fluid header-container">
    <div class="span1">
        <div class="btn-group">
          <a class="btn dropdown-toggle" data-toggle="dropdown" href="#">
            Action
            <span class="caret"></span>
          </a>
          <ul class="dropdown-menu">
            <!-- dropdown menu links -->
            <li><a href="#"><i class="icon-wrench"></i> Settings</a></li>
            <li><a href="#"><i class="icon-bell"></i> Bell</a></li>
            <li><a href="#"><i class="icon-print"></i> Call Stack</a></li>
          </ul>
        </div>
    </div>
    <div class="span5">
      <h4>Statistics <span>Start:{{attrs.start}}</span> <span>End:{{attrs.end}}</span></h4>
    </div>
    <div class="span5">
    </div>
    <div class="span1 window-manager" ng-include src="'views/windowmanager.html'">
    </div>
</div>

<div class="row-fluid insflow-container container-fluid winm">
  <div class="row-fluid">
    <div class="span12">
      <div ng-show="! groups"><img src="styles/img/loader.gif" /></div>
      <select class="input-xlarge" ng-show="groups" ng-model="grouping" ng-options="g.name for g in groupings"></select>
        <select class="input-xlarge" ng-show="groups && grouping.type == 'tgid'" ng-model="group" ng-options="t.percent + '% ' + t.name + '( ' + t.tgid + ' )' for t in groups"></select>
        <select class="input-xlarge" ng-show="groups && grouping.type == 'pid'" ng-model="group" ng-options="t.percent + '% ' + t.name + '( ' + t.pid + ' )' for t in groups"></select>
        <select class="input-xlarge" ng-show="groups && grouping.type == 'module_id'" ng-model="group" ng-options="t.percent + '% ' + t.name + '( ' + t.pid + ' )' for t in groups"></select>
        <span ng-include="groupTemplate"></span>
    </div>
  </div>

  <div class="row-fluid">
    <div ng-show="items" class="span12">
      <table ng-show="groups" class="table table-striped table-bordered table-hover stats">
        <thead><tr>
           <th ng-repeat="th in head" ng-class="selectedCls(th.col)" ng-click="changeSorting(th.col)">{{th.sym}}</th>
        </tr></thead>
        <tr ng-hide="$first" ng-repeat="i in items | orderBy:sort.column:sort.descending">
          <td>{{i.symbol}}</td>
          <td class="aright">{{i.call_count}}</td>
          <td class="aright">{{i.ins}}</td>
          <td class="aright">{{i.ins_per_call | number:0}}</td>
          <td class="aright">{{i.in_thread}}</td>
          <td class="aright">{{i.avg_in_thread}}</td>
          <td class="aright">{{i.in_abs_thread_per_call| number:0}}</td>
          <td class="aright">{{i.min_in_thread}}</td>
          <td class="aright">{{i.max_in_thread}}</td>
          <td class="aright">{{i.out_thread}}</td>
        </tr>
      </table>
    </div>
  </div>
</div>
